package kuang;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author cyt
 * @create 2020-03-08 22:50
 */
public class ThreaPool {
    public static void main(String[] args) {
        // 创建线程池
        ExecutorService service = Executors.newFixedThreadPool(10);
        // 执行线程
        service.submit(new MyThread());
        service.submit(new MyThread());
        service.submit(new MyThread());
        service.submit(new MyThread());
        service.submit(new MyThread());
        // 关闭服务
        service.shutdown();
    }
}

class MyThread implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
